<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends AdminController {
    public function index(){
        $this->display();
    }
    public function head(){
        C('SHOW_PAGE_TRACE',false);
        $this->display();
    }
    public function left(){
        C('SHOW_PAGE_TRACE',false);
        $name=session('name');
        $manager=D('manager')->where("mg_name='$name'")->find();
        $auth_infoA=[];
        $auth_infoB=[];
        if(!empty($manager)){
            $role_id=$manager['mg_role_id'];
            $role=D('role')->find($role_id);
            $auth_ids=$role['role_auth_ids'];

            //admin 超级管理员
            if($name=='admin'){
                $auth_infoA=D('auth')->where("auth_level=0")->select();
                $auth_infoB=D('auth')->where("auth_level>0")->select();
            }else{//普通管理员
                $auth_infoA=D('auth')->where("auth_level=0 and auth_id in ($auth_ids)")->select();
                $auth_infoB=D('auth')->where("auth_level>0 and auth_id in ($auth_ids)")->select();
            }
        }
        $this->assign('infoA',$auth_infoA);
        $this->assign('infoB',$auth_infoB);
        $this->display();
    }
    public function right(){
        dump(session('name'));
        $this->display();
    }
}